package com.chinasofti.test01;

import java.util.Scanner;
//需求：切割字符串
//例如：张三，23.     Student -- name     age
//从该字符串中切割出有效的数据，封装成Student学生对象
//参考方法split
public class TestStudent {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入学生信息");
        String s1 = sc.nextLine();
        String [] s2 = s1.split(",");
        Student stu = new Student();
        stu.setName(s2[0]);
        stu.setAge(s2[1]);
        System.out.println(stu.getName()+"...."+stu.getAge());
    }
}
